package top.eggcode.modules.log.control;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.eggcode.common.mvc.Result;
import top.eggcode.modules.log.model.FuncLogQuery;
import top.eggcode.modules.log.model.FuncLogView;
import top.eggcode.modules.log.service.FuncLogService;
import top.eggcode.base.PackBaseController;

/**
 * Title:
 * Description: TODO
 * Date: 2021/5/25 15:13
 *
 * @author JiaQi Ding
 * @version 1.0
 */
@Api(tags = "函数执行日志")
@AllArgsConstructor
@RequestMapping("/api/log/func")
@RestController
public class FuncLogController extends PackBaseController {

    private final FuncLogService selfService;

    @GetMapping("{id}")
    public Result<?> get(@PathVariable String id) {
        return super.pack(selfService.get(id).get(), FuncLogView.class);
    }

    @ApiOperation("列表分页")
    @GetMapping("list/page")
    public Result<?> listPage(FuncLogQuery query) {

        return super.pack(selfService.page(query), FuncLogView.class);
    }

}
